package 作业1020.zuoye3;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class SchoolClassTest {
    public static void main(String[] args) {
        JClass j76 = new JClass();
        j76.name = "课工场76班";
        j76.startTime = "2021-9-15";
        j76.dirTeacher = "老李";
        j76.techTeacher = "老刘";
        ///j76.stus[0]="孙囡囡";
        Scanner in = new Scanner(System.in);
        int choice = 0;
        while (true) {
            System.out.println("1:添加新生，2：显示全部,3:查找学生，4在指定范围内查找 ，5请输入要查找的位置，6修改学生姓名9：退出");
            choice = in.nextInt();
            if (choice == 1) {
                System.out.print("请输入新生姓名：");
                String sname = in.next();
                j76.add(sname);
            } else if (choice == 2) {
                j76.printInfor();
            } else if (choice == 3) {
                System.out.print("找谁？");
                String sname = in.next();
                boolean b = j76.search(sname);
                System.out.println(b ? "在这个班" : "不在!");
            } else if (choice==4){
                System.out.println("请输入一个区间");
                int a=in.nextInt();
                int b=in.nextInt();
                System.out.println("找谁");
                String sname1=in.next();
                boolean b1=j76.search1(sname1,a,b);
                System.out.println(b1 ? "在这个班" : "不在!");
            }else if (choice==5){
                System.out.println("输入查找的位置");
                int index =in.nextInt();
                j76.find(index);

            }else if (choice==6){
                System.out.println("输入要修改的姓名");
                String oldName = in.next();
                System.out.println("输入修改后的名字");
                String newName = in.next();
                boolean b2=j76.modify(oldName,newName);
                System.out.println(b2?"修改成功":"修改失败");
            }
            else if (choice == 9) {
                break;
            }
        }
        System.out.println("结束了。。。");
    }
}
